﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace AsycServer
{
    partial class Program
    {
        /// <summary>
        /// 连接回调
        /// </summary>
        /// <param name="c"></param>
        public void OnConnect(Client c)
        {
            Console.WriteLine("{0}[{1}, {2}] connected!", c.ID, c.tcpAdress, c.udpAdress);
            clientList.Add(c);

            MessageBuffer msg = new MessageBuffer();
            msg.WriteInt(cProto.CONNECT);
            msg.WriteInt(roleId);
            c.Send(msg);
            roleId++;
        }
    }
}